<?php
class JobsController extends AppController {

	var $name = 'Jobs';

	function index($filter = 'job') {
		$this->Job->recursive = 0;
		$this->set('jobs', $this->Job->get_jobs($filter));
	}
	
	function get_random() {
		$jobs = $this->Job->get_random();
		if (isset($this->params['requested']))
			return $jobs;
		else
			$this->set(compact('jobs'));
	}

	function view($id = null) {
		if (!$id) {
			$this->Session->setFlash(__('Verkeerde vacature of stage', true));
			$this->redirect(array('action' => 'index'));
		}
		if($job = $this->Job->get_job($id)){
			$this->set('job', $job);
		} else {
			$this->redirect(array('action' => 'index'));
		}
	}
}
?>
